//
// System.hpp for System in /home/mambou_j//babel-2014
// 
// Made by jacquesquentin mamboumouafo
// Login   <mambou_j@epitech.net>
// 
// Started on  Mon May 14 19:35:34 2012 jacquesquentin mamboumouafo
// Last update Mon May 14 19:58:37 2012 jacquesquentin mamboumouafo
//


#ifndef	__SYSTEM_HPP__
#define	__SYSTEM_HPP__

#include	"portaudio.h"

// Forward declaration(s):
namespace	portaudio
{
  class	Device;
  class	Stream;
  class	HostApi;
}

// Declaration(s):
namespace	portaudio
{

	class	System
	{
	public:
	  class	HostApiIterator;
	  class	DeviceIterator;

	  static	int version();
	  static	const char *versionText();

	  static	void initialize();
	  static	void terminate();

	  static	System &instance();
	  static	bool exists();

	  // host apis:
	  HostApiIterator	hostApisBegin();
	  HostApiIterator	hostApiEnd();

	  HostApi	&hostApiByTypeId(PaHostapiTypeId type);
	  HostApi	&hostApiByIndex(PaHostApiIndex index);

	  int	hostApiCount();

	  // Devices:
	  DeviceIterator	devicesBegin();
	  DeviceIterator	devicesEnd();

	  Device	&defaultInputDevice();
	  Device	&defaultOutputDevice();

	  Device	&deviceByIndex(PaDeviceIndex index);

	  int	deviceCount();

	  static	Device &nullDevice();

	  // misc:
	  void	sleep (long msec);
	  int	sizeOfSample(PaSampleFormat format);

	private:
	  System();
	  ~System();

	  static	System *instance_;
	  static	int initCount_;

	  static	HostApi **hostApis_;
	  static	Device **devices_;

	  static	Device *nullDevice_;
	};
}

#endif
